home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4792 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  45 lines

  1. Path: newsflash.concordia.ca!not-for-mail
  2. From: ac_march@ece.concordia.ca (Angus C. March)
  3. Newsgroups: comp.lang.c
  4. Subject: gcc bug w/getenv? (running Linux)
  5. Date: 7 Feb 1996 00:49:18 GMT
  6. Organization: ECE - Concordia University
  7. Message-ID: <4f8sue$84d@newsflash.concordia.ca>
  8. NNTP-Posting-Host: hollister.ece.concordia.ca
  9. NNTP-Posting-User: ac_march
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. I seem to suffer this bizarre bug in gcc-2.6.3, that run on Linux 1.2.13. I
  13. tried to assigning a getenv() pointer to a varaible of type char *, but I
  14. got a warning about assigning an integer to a pointer. I tried this little
  15. experiement:
  16. #include <stdio.h>
  17.  
  18. int main()
  19. {
  20.         char *temp;
  21.         int thingi;
  22.  
  23. temp = (char *)getenv("TERM");
  24. thingi = getenv("TERM");
  25.         printf("getenv(term): %s\ntemp: %s\nthingi: %s\n", getenv("TERM"),
  26. temp, thingi);
  27.  
  28.         return 0;
  29. }
  30. The results where facinating:
  31. getenv(term): vt100
  32. temp: vt100
  33. thingi: vt100
  34.     Is this a bona fide bug?
  35.  
  36. --
  37.             http://www.ece.concordia.ca/~ac_march/addr.html
  38.   _________        ___________       ac_march@ece.concordia.ca
  39.  |.........|      |Attempting |
  40.  |: DON'T :|      |recovery...|            Angus March
  41.  |: PANIC :|      |1067 pages |        The Ultra-Mind Dragon
  42.  |:.......:|      |unrecovered|            -==(UDIC)==-
  43.  |---------|___ __|___________|__
  44. /___________\  |_________________| Murphy ain't seen nothing yet
  45.